#include "client.h"
#include <iostream>

using namespace std;

int main() {
    while (true) {
        try {
            Client client{};
            client.monitor();
            string msg{};
            while (true) {
                getline(cin, msg);
                if(msg == "quit") break;
                client.sendMsg(msg.c_str());
            }
            break;
        }catch (const char* err) {
            cout<<err;
            cout<<"是否重试？(y/n)\n";
            char c{};
            cin>>c;
            if(c == 'y') continue;
        }
    }
}